#include "disk.h"
#include "inode.h"
#include <stdlib.h>
#include "blockFreeList.h"
#define NUM_INTS BLOCK_SIZE/sizeof(int)
#define MAX_BLOCKS_IN_FILE 11
#define OFFSET 2

inode_t* getInode(int inodeNumber){
  inode_t* node = malloc(sizeof(inode_t));
  node->inodeNumber = inodeNumber;
  //inodeBlock will contain the inodenumber, size, and block numbers
  //of contents of file
  int inodeBlock[NUM_INTS];
  int disknum = openDisk("root", DISK_SIZE);
  int errnum = readBlock(disknum, inodeNumber, inodeBlock);
  node->size = inodeBlock[1];
  int i;
  //fill inode with block numbers
  for(i = 0; i < MAX_BLOCKS_IN_FILE; ++i){
    node->inodeBlockList[i] = inodeBlock[i+OFFSET];
  }
  return node;
}
